package com.dagger.domain.resp;

import java.io.Serializable;

import com.dagger.enums.MsgTypeEnum;

import lombok.Data;

/**
 * 消息返回
 * 
 * @author dagger
 *
 */
@Data
public class MsgResponse implements Serializable {
	private static final long serialVersionUID = 1L;

	// 消息类型：实时、延时
	private String msgType;
	// 业务类型
	private String bussinessType;
	// 业务ID
	private String bussinessId;
	// 业务状态：200成功
	private int code;
	// 业务信息
	private String msg;
	// 业务数据
	private Object data;

	public static MsgResponse newDelayMessage(String bussinessType2, String bussinessId2, Object msg2) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.DELAY.getCode());
		res.setBussinessType(bussinessType2);
		res.setBussinessId(bussinessId2);
		res.setCode(200);
		res.setData(msg2);
		return res;
	}

	public static MsgResponse newRealtimeMessage(String bussinessType2, String bussinessId2, Object msg2) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.REALTIME.getCode());
		res.setBussinessType(bussinessType2);
		res.setBussinessId(bussinessId2);
		res.setCode(200);
		res.setData(msg2);
		return res;
	}
	
	public static MsgResponse newSuccessMessage(String msg2) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.INTERACTIVE.getCode());
		res.setCode(200);
		res.setMsg(msg2);
		return res;
	}

	public static MsgResponse newSuccessMessage(String bussinessType2, String bussinessId2, String msg2) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.INTERACTIVE.getCode());
		res.setBussinessType(bussinessType2);
		res.setBussinessId(bussinessId2);
		res.setCode(200);
		res.setMsg(msg2);
		return res;
	}

	public static MsgResponse newFailedMessage(String bussinessType2, String bussinessId2, String msg2) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.INTERACTIVE.getCode());
		res.setBussinessType(bussinessType2);
		res.setBussinessId(bussinessId2);
		res.setCode(500);
		res.setMsg(msg2);
		return res;
	}

	public static MsgResponse newFailedMessage(String codeMeta) {
		MsgResponse res = new MsgResponse();
		res.setMsgType(MsgTypeEnum.INTERACTIVE.getCode());
		res.setCode(500);
		res.setMsg(codeMeta);
		return res;
	}

	
}
